const setVueClickGlobalThrottle = Vue => {
  // 节流
  const on = Vue.prototype.$on
  Vue.prototype.$on = function(event, func) {
    // console.info('全局拦截 click $on事件 event', event)
    let previous = 0
    let newFunc = func
    if (event === 'click') {
      // console.info('全局拦截 click 事件 setVueClickGlobalThrottle')
      newFunc = function() {
        const now = new Date().getTime()
        if (previous + 1500 <= now) {
          func.apply(this, arguments)
          previous = now
        }
      }
    }
    on.call(this, event, newFunc)
  }
}

export default setVueClickGlobalThrottle
